﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Catel.Data;

namespace LprConfiger.Models
{
    /// <summary>
    /// Lane Data object class which fully supports serialization, property changed notifications,
    /// backwards compatibility and error checking.
    /// </summary>
#if !SILVERLIGHT
    [Serializable]
#endif
    public class Lane : DataObjectBase<Lane>
    {
        #region Variables
        #endregion

        #region Constructor & destructor
        /// <summary>
        /// Initializes a new object from scratch.
        /// </summary>
        public Lane() { }

#if !SILVERLIGHT
        /// <summary>
        /// Initializes a new object based on <see cref="SerializationInfo"/>.
        /// </summary>
        /// <param name="info"><see cref="SerializationInfo"/> that contains the information.</param>
        /// <param name="context"><see cref="StreamingContext"/>.</param>
        protected Lane(SerializationInfo info, StreamingContext context)
            : base(info, context) { }
#endif
        #endregion

        #region Properties
        // TODO: Define your custom properties here using the dataprop code snippet
        /// <summary>
        /// 车道编号.
        /// </summary>
        public int LaneId
        {
            get { return GetValue<int>(LaneIdProperty); }
            set { SetValue(LaneIdProperty, value); }
        }

        /// <summary>
        /// Register the LaneId property so it is known in the class.
        /// </summary>
        public static readonly PropertyData LaneIdProperty = RegisterProperty("LaneId", typeof(int), 0);

        /// <summary>
        /// 速度限制(公里/小时).
        /// </summary>
        public int SpeedLimit
        {
            get { return GetValue<int>(SpeedLimitProperty); }
            set { SetValue(SpeedLimitProperty, value); }
        }

        /// <summary>
        /// Register the SpeedLimit property so it is known in the class.
        /// </summary>
        public static readonly PropertyData SpeedLimitProperty = RegisterProperty("SpeedLimit", typeof(int), 0);


        /// <summary>
        /// 检测区域X.
        /// </summary>
        public int RoiX
        {
            get { return GetValue<int>(RoiXProperty); }
            set { SetValue(RoiXProperty, value); }
        }

        /// <summary>
        /// Register the RoiX property so it is known in the class.
        /// </summary>
        public static readonly PropertyData RoiXProperty = RegisterProperty("RoiX", typeof(int), 0);

        /// <summary>
        /// 检测区域Y.
        /// </summary>
        public int RoiY
        {
            get { return GetValue<int>(RoiYProperty); }
            set { SetValue(RoiYProperty, value); }
        }

        /// <summary>
        /// Register the RoiX property so it is known in the class.
        /// </summary>
        public static readonly PropertyData RoiYProperty = RegisterProperty("RoiY", typeof(int), 0);


        /// <summary>
        /// 检测区域宽.
        /// </summary>
        public int RoiW
        {
            get { return GetValue<int>(RoiWProperty); }
            set { SetValue(RoiWProperty, value); }
        }

        /// <summary>
        /// Register the RoiX property so it is known in the class.
        /// </summary>
        public static readonly PropertyData RoiWProperty = RegisterProperty("RoiW", typeof(int), 0);


        /// <summary>
        /// 近摄像头端拉伸比例.
        /// </summary>
        public float NearCamStretchFactor
        {
            get { return GetValue<float>(NearCamStretchFactorProperty); }
            set { SetValue(NearCamStretchFactorProperty, value); }
        }

        /// <summary>
        /// Register the RoiX property so it is known in the class.
        /// </summary>
        public static readonly PropertyData NearCamStretchFactorProperty = RegisterProperty("NearCamStretchFactor", typeof(float), 0.0);


        /// <summary>
        /// 近摄像头端拉伸比例.
        /// </summary>
        public float FarCamStretchFactor
        {
            get { return GetValue<float>(FarCamStretchFactorProperty); }
            set { SetValue(FarCamStretchFactorProperty, value); }
        }

        /// <summary>
        /// Register the RoiX property so it is known in the class.
        /// </summary>
        public static readonly PropertyData FarCamStretchFactorProperty = RegisterProperty("FarCamStretchFactor", typeof(float), 0.0);

        /// <summary>
        /// 检测区域髙.
        /// </summary>
        public int RoiH
        {
            get { return GetValue<int>(RoiHProperty); }
            set { SetValue(RoiHProperty, value); }
        }

        /// <summary>
        /// Register the RoiX property so it is known in the class.
        /// </summary>
        public static readonly PropertyData RoiHProperty = RegisterProperty("RoiH", typeof(int), 0);

        #endregion

        #region Methods
        /// <summary>
        /// Validates the fields.
        /// </summary>
        protected override void ValidateFields()
        {
            // TODO: Implement any field validation of this object. Simply set any error by using the SetFieldError method
        }

        /// <summary>
        /// Validates the business rules.
        /// </summary>
        protected override void ValidateBusinessRules()
        {
            // TODO: Implement any business rules of this object. Simply set any error by using the SetBusinessRuleError method
        }
        #endregion
    }
}
